<?php

namespace Part01_SimpleFactoryMode\Code4;

/**
 * @desc: 运算工厂类
 * @date: 2021/9/9
 */
class OperationFactory
{
    public static function createOperate($operate)
    {
        $opeObj = null;
        switch ($operate) {
            case '+':
                $opeObj = new OperationAdd();
                break;
            case '-':
                $opeObj = new OperationSub();
                break;
            case '*':
                $opeObj = new OperationMul();
                break;
            case '/':
                $opeObj = new OperationDiv();
                break;
        }
        return $opeObj;
    }
}